#include<iostream>
#include<map>
using namespace std;
map<int, int>mp;
typedef long long LL;
const int N = 1e3 + 10;
int n, k;	
int a[N];
#define int long long 
bool check(int x)
{
	for (int i = 1; i <= n; i++) {
		int cnt = 0;
		int ans = x;
		bool flag = 0;
		int j = i;
		for (; j <= n; j++) {
			if (a[j] < ans) {
				cnt += (ans - a[j]);
				//cout << "x==" << x << endl;
				//cout << "cnt==" << endl;
				ans--;
			}
			else {
				flag = 1;
				break;
			}
		}
		if (cnt <= k && j <= n) {
			//cout << "i===" << i << endl;
			return 1;
		}
	}
	return 0;
}
signed main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> n >> k;
		for (int i = 1; i <= n; i++) {
			cin >> a[i];
		}
		int l = 0, r = 1e9;
		while (l + 1 < r) {
			int mid = (l + r) >> 1;
			if (check(mid))l = mid;
			else r = mid;
		}
		cout << l << endl;
	}
	return 0;
}